<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ page import="java.util.*, com.dr.pojo.*" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Insert title here</title>

<script type="text/javascript" src="/lib/jquery-3.4.1.js"></script>
<script type="text/javascript">
	$(function(){
		$('#btnSubmit').click(function(){
			if(chkPassword()==true){
				$("#frm").attr("action","/um/doAdd")
				$("#frm").submit();
			}	
		});
	});

	function chkPassword(){
		//验证密码
		var passwordValue = $('#password').val()
		var cfmPwdValue = $('#cfmPwd').val()

		if(passwordValue==""){
			alert("密码不能为空");
			return false;
		}
		else if(passwordValue != cfmPwdValue){
			alert("两次输入的密码必须一致！");
			return false;
		}
		else {
			return true;
		}		
	}
</script>

</head>
<body>
	<div >
		<h4>系统用户新增</h4>
		<form id="frm">
			<table class="table-list">
				<tr>
					<td>系统账户：</td>
					<td>
						<input type="text" name="account">
						<span style="color: red"><%=request.getAttribute("attrInfoUserAdd")==null?"":request.getAttribute("attrInfoUserAdd") %></span>
					</td>
					
				</tr>
				<tr>
					<td>用户名：</td>
					<td><input type="text" name="name"></td>
				</tr>
				<tr>
					<td>密码：</td>
					<td><input type="password" id="password" name="password"></td>
				</tr>
				<tr>
					<td>密码确认：</td>
					<td><input type="password" id="cfmPwd"></td>
				</tr>
				<tr>
					<td>岗位：</td>
					<td><input type="text" name="job"></td>
				</tr>
				<tr>
					<td>部门：</td>
					<td>		
						<select name="deptId">
						<%
							List<Dept> list = (List)request.getAttribute("deptList");
							for(Dept dept : list){
						%>
								<option value="<%=dept.getDeptId() %>"><%=dept.getDeptName() %></option>
						<% 
							}
						%>		
						</select>
					</td>	
				</tr>
				<tr>
					<td>账户启用：</td>
					<td><input type="checkbox" name="enable" value="1" checked></td>
				</tr>
				
			</table>
			<input type="button" name="" id="btnSubmit" value="提交" />
			<input type="button" name="" id="" value="重置" />	
		</form>

	</div>
</body>
</html>